package com.annarborales;

public class BeerMaker {

	Beer beer;
	double agingTemperature = 0;
	double agingDuration = 1000;

	public String getNameOfBeer() {
		return beer.getName();
	}
	public double getAgingDuration() {
		return agingDuration;
	}

	public void setAgingDuration(double agingDuration) {
		this.agingDuration = agingDuration;
	}

	public double getAgingTemperature() {
		return agingTemperature;
	}

	public void setAgingTemperature(double agingTemperature) {
		this.agingTemperature = agingTemperature;
	}

	public BeerMaker(Beer beer) {
		this.beer = beer;
	}

	public boolean ageTheBeer() throws AgingTemperatureException {
		
		double requiredAgingTemperature = beer.getAgingTemperature();
		
		if (agingTemperature < requiredAgingTemperature - 10
				|| agingTemperature > requiredAgingTemperature + 10)
			throw new AgingTemperatureException(
					"The Room Temperature for Aging is "
							+ this.agingTemperature
							+ " but the required aging temperature is "
							+ requiredAgingTemperature);
		
		if ( beer.getAgingDuration() <= agingDuration )
			return true;
		else
			return false;
		
	}

}
